package com.k7.mobile.platform.dao.impl;

import java.util.List;

import com.k7.mobile.platform.dao.IUserDAO;
import com.k7.mobile.platform.dataobject.UserDO;

@SuppressWarnings("unchecked")
public class UserDAOImpl extends BaseDAOImpl implements IUserDAO{
	
	@Override
	public List<UserDO> getUserList(UserDO queryDO) {
		return this.executeQueryForList("GET-USER-LIST", "GET-USER-LIST-COUNT", queryDO);
	}

	@Override
	public UserDO getUserById(Long userId) {
		return (UserDO)this.getSqlMapClientTemplate().queryForObject("GET-USER-BY-ID", userId);
	}

	@Override
	public void addUser(UserDO userDO) {
		this.getSqlMapClientTemplate().insert("ADD-USER", userDO);
	}

	@Override
	public void updateUser(UserDO userDO) {
		this.getSqlMapClientTemplate().update("UPDATE-USER", userDO);
	}
	
	@Override
	public void updateUserCount(UserDO userDO) {
		this.getSqlMapClientTemplate().update("UPDATE-USER-COUNT", userDO);
	}
}
